import { BaseModal } from "@/service/general/modal/common"

interface RequestKnowledgeBase {
    id?: string | null,
    name?: string,
    intro?: string,
    vectorModel?: string,
    agentModel?: string,
}

interface FileInfo {
    id: string,
    fileName: string,
    fileSize: string | number,
    upProgress: number,
    fileId: string,
    data?: File | null
}

interface LinkInfo {
    id: string,
    url: string,
}

interface RequestTextModal {
    id: string,
    name: string,
    trainingType: string,
    text: string,
    selector: string,
    link: LinkInfo[],
    files: FileInfo[]
}

interface CreateApplicationModal extends BaseModal {
    type: "CreateApplicationModal",
    id?: string,
    name: string,
    model: string,
    prompt: string,
    maxImport: string,
    minAbout: string,
    datasetIds: string,
    checkModel: string,
    intro?: string,
}

const NewCreateApplicationModal = (data: Omit<CreateApplicationModal, "type">): CreateApplicationModal => { 
    return {
        type: "CreateApplicationModal",
        ...data
    };
}

interface DatasetDataIndex {
    dataId?: string,
    type?: string,
    text: string,
    _id?: string,
}
interface DatasetData {
    dataId?: string,
    q: string,
    a: string,
    indexes: DatasetDataIndex[],
}

interface RequestDatasetData {
    collectionId: string,
    trainingType: string,
    data: DatasetData[],
}

interface CreateThirdApplication extends BaseModal {
    type: "CreateThirdApplication",
    id?: string,
    name: string,
    intro?: string,
    appType: string,
    appUrl: string,
    appKey: string,
    isTsoar?: boolean,
    prompt?: string,
}

const NewCreateThirdApplication = (data: Omit<CreateThirdApplication, "type">): CreateThirdApplication => { 
    return {
        type: "CreateThirdApplication",
        ...data
    };
}

interface RequestExecTool {
    appId: string,
    prompt: string,
    input: string,
}

export type {
    LinkInfo,
    FileInfo,
    RequestKnowledgeBase,
    RequestTextModal,
    CreateApplicationModal,
    DatasetDataIndex,
    DatasetData,
    RequestDatasetData,
    CreateThirdApplication,
    RequestExecTool,
}

export {
    NewCreateApplicationModal,
    NewCreateThirdApplication
}